package com.ciwong.epaper.modules.epaper.dao;

import android.text.TextUtils;
import android.util.Log;

import com.android.volley.AuthFailureError;
import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.ciwong.ciwongwrite.utils.CWUtils;
import com.ciwong.epaper.application.EApplication;
import com.ciwong.epaper.application.EpaperConstant;
import com.ciwong.epaper.modules.bookstore.bean.NewBookReadNetBean;
import com.ciwong.epaper.modules.epaper.bean.BasePaging;
import com.ciwong.epaper.modules.epaper.bean.BookCaseBean;
import com.ciwong.epaper.modules.epaper.bean.CatelogBean;
import com.ciwong.epaper.modules.epaper.bean.DeleteEP;
import com.ciwong.epaper.modules.epaper.bean.DeleteEpInfo;
import com.ciwong.epaper.modules.epaper.bean.EpaperInfo;
import com.ciwong.epaper.modules.epaper.bean.GradeBean;
import com.ciwong.epaper.modules.epaper.bean.Module;
import com.ciwong.epaper.modules.epaper.bean.MyGrade;
import com.ciwong.epaper.modules.epaper.bean.NewBook;
import com.ciwong.epaper.modules.epaper.bean.NewReadBookNetResultBean;
import com.ciwong.epaper.modules.epaper.bean.Result_scoce;
import com.ciwong.epaper.modules.epaper.bean.SchoolPageBean;
import com.ciwong.epaper.modules.epaper.bean.SearchBookKeyNameBean;
import com.ciwong.epaper.modules.epaper.bean.Subject;
import com.ciwong.epaper.modules.epaper.bean.TempWorkAnswers;
import com.ciwong.epaper.modules.epaper.bean.UserEpage;
import com.ciwong.epaper.modules.epaper.bean.VideoExplainWorkAnswers;
import com.ciwong.epaper.modules.epaper.bean.VideoRecord;
import com.ciwong.epaper.modules.epaper.bean.ZipPackageInfo;
import com.ciwong.epaper.modules.evaluate.bean.DKAnswer;
import com.ciwong.epaper.modules.evaluate.bean.DKresult;
import com.ciwong.epaper.modules.evaluate.bean.DkWorkDetail;
import com.ciwong.epaper.modules.evaluate.bean.EssayAnswer;
import com.ciwong.epaper.modules.evaluate.bean.EssayResult;
import com.ciwong.epaper.modules.evaluate.bean.UserDKPageBean;
import com.ciwong.epaper.modules.me.bean.BookDeskBean;
import com.ciwong.epaper.modules.me.bean.BookDeskCataloguesBean;
import com.ciwong.epaper.modules.me.bean.BookMarkPageInfo;
import com.ciwong.epaper.modules.me.bean.CheckValidBean;
import com.ciwong.epaper.modules.me.bean.DubHotWord;
import com.ciwong.epaper.modules.me.bean.EpaperInfoGradeCategoryBean;
import com.ciwong.epaper.modules.me.bean.InteractionCategoryBean;
import com.ciwong.epaper.modules.me.bean.KefuBean;
import com.ciwong.epaper.modules.me.bean.MyWork;
import com.ciwong.epaper.modules.me.bean.PlanBean;
import com.ciwong.epaper.modules.msg.bean.SymbolsContent;
import com.ciwong.epaper.modules.msg.bean.WorkContent;
import com.ciwong.epaper.modules.scan.bean.EpaperQRInfo;
import com.ciwong.epaper.util.BaseExtCallBack;
import com.ciwong.epaper.util.DeviceUtil;
import com.ciwong.epaper.util.EConstants;
import com.ciwong.epaper.util.FeedbackUtil;
import com.ciwong.epaper.util.IntentValue;
import com.ciwong.epaper.utils.GsonUtil;
import com.ciwong.libs.utils.CWLog;
import com.ciwong.libs.utils.volley.BaseRequest;
import com.ciwong.libs.utils.volley.HttpRequest;
import com.ciwong.mobilelib.i.BaseCallBack;
import com.ciwong.mobilelib.utils.BaseRequestUtil;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.UnsupportedEncodingException;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 电子报 相关网络请求
 *
 * @author bin
 * @version ciwong v.1.0 2015/7/23 19:52
 * @since ciwong v.1.0
 */
public class EpaperRequest {
    /**
     * 根据服务ID获取书籍
     *
     * @param schoolId 学校ID
     * @param brandId  服务ID
     * @param callBack 回调
     */
    public static void getAdvisor(long schoolId, long brandId, final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION,
                EpaperAction.ACTION_GET_EPAGE_ADVISOR);
        params.put("sIds", schoolId + "");
        params.put("brandId", brandId + "");
        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {

                    @Override
                    public void onErrorResponse(VolleyError error) {
                        callBack.failed(error);
                    }
                }, new BaseRequest.ResponseCallback() {

            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        Type responseType = new TypeToken<List<KefuBean>>() {
        }.getType();
        request.setResponseType(responseType);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());
    }

    /**
     * 根据服务ID获取书籍
     *
     * @param schoolId  学校ID
     * @param serviceId 服务ID
     * @param page      页码
     * @param pageSize  每页条数
     * @param callBack  回调
     */
    public static void getServiceBooks(long schoolId, long serviceId, int page,
                                       int pageSize, final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION,
                EpaperAction.ACTION_GET_SERVICE_BOOKS);
        params.put("schoolId", schoolId + "");
        params.put("serviceId", serviceId + "");
        params.put("pageIndex", page + "");
        params.put("pageSize", pageSize + "");
        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {

                    @Override
                    public void onErrorResponse(VolleyError error) {
                        callBack.failed(error);
                    }
                }, new BaseRequest.ResponseCallback() {

            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        Type responseType = new TypeToken<BasePaging<EpaperInfo>>() {
        }.getType();
        request.setResponseType(responseType);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());
    }

    /**
     * 根据品牌ID获取书籍
     *
     * @param brandId
     * @param callBack
     */
    public static void getEpageBookcase(int brandId, int pageIndex, int pageSize, final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION,
                EpaperAction.ACTION_SELECT_EPAGE_BOOKCASE);
        params.put("brandId", brandId + "");
        params.put("pageIndex", pageIndex + "");
        params.put("pageSize", pageSize + "");

        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {

                    @Override
                    public void onErrorResponse(VolleyError error) {
                        callBack.failed(error);
                    }
                }, new BaseRequest.ResponseCallback() {

            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        request.setResponseClazz(UserEpage.class);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());
    }

    /**
     * 根据品牌ID获取书籍
     *
     * @param brandId
     * @param callBack
     */
    public static void getEpageBookcaseAll(int brandId, final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION,
                EpaperAction.ACTION_SELECT_EPAGE_BOOKCASE_ALL);
        params.put("brandId", brandId + "");

        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {

                    @Override
                    public void onErrorResponse(VolleyError error) {
                        callBack.failed(error);
                    }
                }, new BaseRequest.ResponseCallback() {

            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        request.setResponseClazz(UserEpage.class);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());
    }

    /**
     * * 根据关键字搜索书籍
     *
     * @param brandId
     * @param grade
     * @param serviceId
     * @param keyWords
     * @param pageIndex
     * @param pageSize
     * @param baseCallBack
     */
    public static void getSearchingBookListByKyeWord(String brandId, String grade, String serviceId, String keyWords, int pageIndex, int pageSize, final BaseCallBack baseCallBack) {

        getUserProductByKey(brandId, grade, serviceId, keyWords, pageIndex, pageSize, baseCallBack);
//        Map<String, String> params = new HashMap<String, String>();
//        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
//        params.put(HttpRequest.REQUEST_ACTION,
//                EpaperAction.ACTION_GET_BOOK_BY_SERVICEID_ANDKEYWORD);
//        params.put("brandId", brandId + "");
////        params.put("sIds", serviceIds);
//        params.put("pIndex", page + "");
//        params.put("psize", pageSize + "");
//        try {
//            String keyWords = java.net.URLEncoder.encode(searching_book_str, "UTF-8");
//            params.put("keyWords", keyWords);
//        } catch (UnsupportedEncodingException e) {
//            e.printStackTrace();
//        }
//
//
//        HttpRequest request = new HttpRequest(params,
//                new Response.ErrorListener() {
//
//                    @Override
//                    public void onErrorResponse(VolleyError error) {
//                        callBack.failed(error);
//                    }
//                }, new BaseRequest.ResponseCallback() {
//
//            @Override
//            public void error(int errorCode, String msg) {
//                callBack.failed(errorCode, msg);
//
//            }
//
//            @Override
//            public void success(Object obj, int resultCode,
//                                int errorCode, String msg) {
//                if (resultCode == 0 && errorCode == 0) {
//                    callBack.success(obj);
//                } else {
//                    callBack.failed(errorCode, msg);
//                }
//            }
//        });
//        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
//        Type responseType = new TypeToken<BasePaging<EpaperInfo>>() {
//        }.getType();
//        request.setResponseType(responseType);
//        BaseRequestUtil.getInstance().add(request);
    }


    public static void searchBookAndService(int brandId, int page,
                                            int pageSize, int gradeId, int subjectId, int salesType, String searching_book_str, final BaseCallBack callBack) {

        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION,
                EpaperAction.ACTION_SEARCH_BOOK_AND_SERVICE);

        params.put("brandId", brandId + "");
//        params.put("sIds", serviceIds);
        params.put("pIndex", page + "");
        params.put("psize", pageSize + "");

        params.put("gradeId", gradeId + "");
        params.put("subjectId", subjectId + "");

        params.put("salesType", salesType + "");


        try {
            String keyWords = java.net.URLEncoder.encode(searching_book_str, "UTF-8");
            params.put("keyWords", keyWords);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }


        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {

                    @Override
                    public void onErrorResponse(VolleyError error) {
                        callBack.failed(error);
                    }
                }, new BaseRequest.ResponseCallback() {

            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);

            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        Type responseType = new TypeToken<BasePaging<NewBook>>() {
        }.getType();
        request.setResponseType(responseType);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());
    }


    /**
     * 根据服务ID、页码、页数获得书籍列表
     *
     * @param brandId
     * @param serviceIds
     * @param page
     * @param pageSize
     * @param callBack
     */
    public static void getBookListByServiceID(int brandId, String serviceIds, int page,
                                              int pageSize, final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION,
                EpaperAction.ACTION_GET_BOOK_BY_SERVICEID_ANDKEYWORD);
        params.put("brandId", brandId + "");
        params.put("sIds", serviceIds);
        params.put("pIndex", page + "");
        params.put("psize", pageSize + "");
        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError error) {
                        callBack.failed(error);
                    }
                }, new BaseRequest.ResponseCallback() {

            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);

            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        Type responseType = new TypeToken<BasePaging<EpaperInfo>>() {
        }.getType();
        request.setResponseType(responseType);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());
    }

    /**
     * 获取书籍目录
     *
     * @param packageId 资源包ID
     * @param cId       书籍目录ID(全部：-1)
     * @param tag       网络请求tag
     * @param callBack  回调
     */
    public static void getBookCatalogue(String packageId, String cId,
                                        Object tag, final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION,
                EpaperAction.ACTION_BOOK_CATALOGUES);
        String privateKey = "f8dae342c5ba5ced2c4945e053ab2676";
        String str[] = {packageId, privateKey};
        Arrays.sort(str);
        StringBuffer pwdstr = new StringBuffer();
        for (int i = 0; i < str.length; i++) {
            if (i < str.length - 1) {
                pwdstr.append(str[i] + "_");
            } else if (i == str.length - 1) {
                pwdstr.append(str[i]);
            }
        }
        String sign = CWUtils.md5(CWUtils.md5(String.valueOf(pwdstr)));
        params.put("packageId", packageId);
        params.put("cId", cId);
        params.put("sign", sign);
//        params.put("packageId","2568");
//        params.put("scope","all");
//        params.put("termtype","2");
        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {

                    @Override
                    public void onErrorResponse(VolleyError error) {
                        callBack.failed(error);
                    }
                }, new BaseRequest.ResponseCallback() {

            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        //后台没数据临时
//        Type responseType = new TypeToken<List<CatalogueInfo>>() {
//        }.getType();
//        request.setResponseType(responseType);
        request.setResponseClazz(CatelogBean.class);
        BaseRequestUtil.getInstance().add(request, tag);
        callBack.setUrl(request.getUrl());

    }


    /**
     * 获取书籍目录
     *
     * @param packageId 资源包ID
     * @param cId       书籍目录ID(全部：-1)
     * @param tag       网络请求tag
     * @param callBack  回调
     */
    public static void getCatalogueResourceList(String packageId, String cId,
                                                Object tag, boolean isFromDesk, int fromResource, final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        if (isFromDesk) {
            params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
            params.put(HttpRequest.REQUEST_ACTION,
                    EpaperAction.ACTION_CATALOGUES_RESOURCE_FORMDESK);
            params.put("packageId", packageId);
            params.put("unitId", cId);
            String privateKey = "f8dae342c5ba5ced2c4945e053ab2676";
            String str[] = {packageId, cId, privateKey};
            Arrays.sort(str);
            StringBuffer pwdstr = new StringBuffer();
            for (int i = 0; i < str.length; i++) {
                if (i < str.length - 1) {
                    pwdstr.append(str[i] + "_");
                } else if (i == str.length - 1) {
                    pwdstr.append(str[i]);
                }
            }
            String sign = CWUtils.md5(CWUtils.md5(String.valueOf(pwdstr)));
            params.put("sign", sign);

        } else {
            params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
            if (fromResource == IntentValue.JumpToBookCatalogType.FROM_RESOURCE_CENTER_DICTATION) {
                params.put(HttpRequest.REQUEST_ACTION,
                        EpaperAction.ACTION_CATALOGUES_RESOURCE_DICTATION);
            } else {
                params.put(HttpRequest.REQUEST_ACTION,
                        EpaperAction.ACTION_CATALOGUES_RESOURCE);
            }

            params.put("packageId", packageId);
            params.put("cId", cId);

        }

        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {

                    @Override
                    public void onErrorResponse(VolleyError error) {
                        callBack.failed(error);
                    }
                }, new BaseRequest.ResponseCallback() {

            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        //后台没数据临时
//        Type responseType = new TypeToken<List<CatalogueInfo>>() {
//        }.getType();
//        request.setResponseType(responseType);
        Type responseType = new TypeToken<List<Module>>() {
        }.getType();
        request.setResponseType(responseType);
        BaseRequestUtil.getInstance().add(request, tag);
        callBack.setUrl(request.getUrl());
    }


    /**
     * 学生根据考生用书ID获取布置作业章节记录
     *
     * @param brandId
     * @param serviceId
     * @param packageId
     * @param callBack
     */
    public static void getReceiveBookchapters(int brandId, int serviceId, String packageId, final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION, EpaperAction.ACTION_GET_BOOKCHAPTERS);
        params.put("brandId", brandId + "");
        params.put("serviceId", serviceId + "");
        params.put("packageId", packageId + "");
        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {

                    @Override
                    public void onErrorResponse(VolleyError error) {
                        callBack.failed(error);
                    }

                }, new BaseRequest.ResponseCallback() {


            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }


            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {

                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }


        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        Type responseType = new TypeToken<List<String>>() {
        }.getType();
        request.setResponseType(responseType);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());

    }


    /**
     * 获取我的作业
     *
     * @param brandId  品牌ID
     * @param page     页码
     *                 workMode  0：所有(默认) 1：机房作业  3：练习和考试作业 ）
     * @param pageSize 每页数量
     * @param workType 请求作业类型 0 全部；1未完成；2已完成
     * @param callBack 回调
     */
    public static void getMyWork(int brandId, int workMode, int page, int pageSize, int workType, boolean isErrorWork, boolean isClassWork,
                                 final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        if (isErrorWork) {
            params.put(HttpRequest.REQUEST_ACTION, EpaperAction.ACTION_GET_MY_ERROR_WORK);
        } else if (isClassWork) {
            params.put(HttpRequest.REQUEST_ACTION, EpaperAction.ACTION_GET_USER_CLASS_WORKS);
        } else {
            if (DeviceUtil.isPad()) {
                params.put(HttpRequest.REQUEST_ACTION, EpaperAction.ACTION_GET_MY_WORK_PAD);
            } else {
                params.put(HttpRequest.REQUEST_ACTION, EpaperAction.ACTION_GET_MY_WORK);
            }
        }
        params.put("workMode", workMode + "");
        params.put("brandId", brandId + "");
        params.put("page", page + "");
        params.put("pageSize", pageSize + "");
        params.put("workType", workType + "");
        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {

                    @Override
                    public void onErrorResponse(VolleyError error) {
                        callBack.failed(error);
                    }

                }, new BaseRequest.ResponseCallback() {


            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }


            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {

                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }


        });

        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        Type responseType = new TypeToken<BasePaging<MyWork>>() {
        }.getType();
        request.setResponseType(responseType);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());

    }

    public static void getmygrade(int brandId, String moduleIds,
                                  final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION, EpaperAction.ACTION_GET_MY_GRADE);
        params.put("brandId", brandId + "");
        params.put("resourceTypes", moduleIds);

        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {

                    @Override
                    public void onErrorResponse(VolleyError error) {
                        callBack.failed(error);
                    }

                }, new BaseRequest.ResponseCallback() {


            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }


            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {

                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }


        });

        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        Type responseType = new TypeToken<List<MyGrade>>() {
        }.getType();

        request.setResponseType(responseType);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());

    }


    /**
     * 获取zip 更新信息
     *
     * @param callBack 回调
     */
    public static void getZipPackageUpdateInfo(String appVersion,
                                               final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION, EpaperAction.ACTION_GET_ZIP_PACKAGE_LIST);
        params.put("version", appVersion);
        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {

                    @Override
                    public void onErrorResponse(VolleyError error) {
                        callBack.failed(error);
                    }

                }, new BaseRequest.ResponseCallback() {


            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {

                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }


        });

        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        Type responseType = new TypeToken<List<ZipPackageInfo>>() {
        }.getType();

        request.setResponseType(responseType);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());
    }


    /**
     * 获取报名活动广告栏信息
     *
     * @param brandId 品牌ID
     */
    public static void getAdverts(int brandId, long userId, final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION, EpaperAction.ACTION_GET_ADVERT);
        params.put("brandId", brandId + "");
        params.put("userId", userId + "");
        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {

                    @Override
                    public void onErrorResponse(VolleyError error) {
                        callBack.failed(error);
                    }

                }, new BaseRequest.ResponseCallback() {

            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {

                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });

        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        request.setResponseClazz(PlanBean.class);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());
    }


    /**
     * 作业通知回执
     *
     * @param workIds
     * @param callBack
     */
    public static void setWorkNotifyRead(String workIds,
                                         final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION,
                EpaperAction.ACTION_GET_SET_READ);
        params.put("workIds", workIds + "");
        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {

                    @Override
                    public void onErrorResponse(VolleyError error) {
                        callBack.failed(error);
                    }
                }, new BaseRequest.ResponseCallback() {

            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        request.setResponseClazz(Boolean.class);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());
    }

    /**
     * [学生]获取章节目录信息以及下载地址
     *
     * @param packageId 资源包ID
     * @param cId       章节ID
     * @param callBack
     */
    public static void getCatalogueInfo(String packageId, String cId, final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION,
                EpaperAction.ACTION_GET_CATALOGUE_INFO_NEW);
        params.put("packageId", packageId);
        params.put("cId", cId);
        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {

                    @Override
                    public void onErrorResponse(VolleyError error) {
                        if (null != callBack)
                            callBack.failed(error);
                    }
                }, new BaseRequest.ResponseCallback() {

            @Override
            public void error(int errorCode, String msg) {
                if (null != callBack)
                    callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    if (null != callBack)
                        callBack.success(obj);
                } else {
                    if (null != callBack)
                        callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        request.setResponseClazz(EpaperQRInfo.class);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());

    }

    public static void getNewReadBookInfo(String packageId, String cId, String moduleId, String versionId, final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION,
                EpaperAction.ACTION_GET_CATALOGUE_INFO_NEW);

        params.put("packageId", packageId);
        params.put("cId", cId);
        params.put("moduleId", moduleId);
        params.put("versionId", versionId);

        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {

                    @Override
                    public void onErrorResponse(VolleyError error) {
                        if (null != callBack)
                            callBack.failed(error);
                    }
                }, new BaseRequest.ResponseCallback() {

            @Override
            public void error(int errorCode, String msg) {
                if (null != callBack)
                    callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    if (null != callBack)
                        callBack.success(obj);
                } else {
                    if (null != callBack)
                        callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        request.setResponseClazz(NewReadBookNetResultBean.class);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());
    }


    public static void getWordDetail(String brandId, String state, String word,  final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION,
                EpaperAction.ACTION_GET_WORD_STOCK_ENGLISH);

        params.put("brandId", brandId);
        params.put("state", state);
        params.put("word", word);

        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {

                    @Override
                    public void onErrorResponse(VolleyError error) {
                        if (null != callBack)
                            callBack.failed(error);
                    }
                }, new BaseRequest.ResponseCallback() {

            @Override
            public void error(int errorCode, String msg) {
                if (null != callBack)
                    callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    if (null != callBack)
                        callBack.success(obj);
                } else {
                    if (null != callBack)
                        callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        request.setResponseClazz(NewReadBookNetResultBean.class);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());
    }


    /**
     * [学生]获取章节目录信息以及下载地址
     *
     * @param packageId 资源包ID
     * @param cId       章节ID
     * @param callBack
     */
    public static void getCatalogueInfo(String packageId, String cId, String moduleId, String versionId, final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION,
                EpaperAction.ACTION_GET_CATALOGUE_INFO_NEW);

        params.put("packageId", packageId);
        params.put("cId", cId);
        params.put("moduleId", moduleId);
        params.put("versionId", versionId);

        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {

                    @Override
                    public void onErrorResponse(VolleyError error) {
                        if (null != callBack)
                            callBack.failed(error);
                    }
                }, new BaseRequest.ResponseCallback() {

            @Override
            public void error(int errorCode, String msg) {
                if (null != callBack)
                    callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    if (null != callBack)
                        callBack.success(obj);
                } else {
                    if (null != callBack)
                        callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        request.setResponseClazz(EpaperQRInfo.class);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());
    }

    /**
     * 提交作业答案
     *
     * @param oldJson  答案json
     * @param callBack 回调
     */

    public static void submit(final String oldJson, int workType, final String workId, Class clazz, final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        if (workType == 1) {
            params.put(HttpRequest.REQUEST_ACTION, EpaperAction.ACTION_SUBMIT_ERROR_WORKS);
        } else {
            params.put(HttpRequest.REQUEST_ACTION, EpaperAction.ACTION_SUBMIT_WORKS);
        }
        String sign = DeviceUtil.hmacSha1(oldJson, EConstants.HMACSHA1_SECRECT);
        params.put("sign", sign);
        JSONObject jsonObject = new JSONObject();
        try {
            jsonObject.put("data", oldJson);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        final String json = jsonObject.toString();
        HeadOverrideRequest request = new HeadOverrideRequest(Request.Method.POST, params,
                new Response.ErrorListener() {

                    @Override
                    public void onErrorResponse(VolleyError error) {
                        callBack.failed(error);
                    }
                }, new BaseRequest.ResponseCallback() {

            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
                String logDesc = "习网服务器提交答案失败  " + json;
                String remark = "workId==" + workId + "; errorCOde==" + errorCode + " ; msg==" + msg;
                FeedbackUtil.getInstance().addFeedbackLog(FeedbackUtil.FEEDBACK_TYPE_SUBMIT_WORK, logDesc, remark);
            }

            @Override
            public void success(Object obj, int resultCode, int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    if (null != callBack)
                        callBack.success(obj);
                } else {
                    if (null != callBack) {
                        callBack.failed(errorCode, msg);

                        String logDesc = "习网服务器提交答案失败  " + json;
                        String remark = "workId==" + workId + "; errorCOde==" + errorCode + " ; msg==" + msg;
                        FeedbackUtil.getInstance().addFeedbackLog(FeedbackUtil.FEEDBACK_TYPE_SUBMIT_WORK, logDesc, remark);
                    }
                }
            }
        }) {
            @Override
            public byte[] getBody() throws AuthFailureError {
                return json.getBytes();
            }
        };
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        request.setResponseClazz(clazz);
        BaseRequestUtil.getInstance().add(request, "" + workId);
        callBack.setUrl(request.getUrl());
    }

    /**
     * 提交打卡作业
     */
    public static void submitDkWork(final DKAnswer dkAnswer, final BaseExtCallBack callBack) {

        Map<String, String> params = new HashMap<String, String>();
        String name = EpaperAction.class.getName();
        params.put(HttpRequest.REQUEST_MODULES, name);
        params.put(HttpRequest.REQUEST_ACTION, EpaperAction.ACTION_SUBMIT_DK_WORK);
        final String json = com.alibaba.fastjson.JSONObject.toJSONString(dkAnswer);
        HeadOverrideRequest request = new HeadOverrideRequest(Request.Method.POST, params,
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError volleyError) {
                        callBack.failed(volleyError);
                    }
                }, new BaseRequest.ResponseCallback() {
            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);

            }

            @Override
            public void success(Object obj, int resultCode, int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    if (null != callBack)
                        callBack.success(obj);
                } else {
                    if (null != callBack) {
                        callBack.failed(errorCode, msg);
                    }
                }
            }
        }) {
            @Override
            public byte[] getBody() throws AuthFailureError {
                return json.getBytes();
            }
        };

        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        request.setResponseClazz(DKresult.class);
        BaseRequestUtil.getInstance().add(request, "" + dkAnswer.getWorkId());
        callBack.setUrl(request.getUrl());
    }

    /**
     * 提交打卡作业
     */
    public static void submitEssayWork(final EssayAnswer essayAnswer, final BaseExtCallBack callBack) {

        Map<String, String> params = new HashMap<String, String>();
        String name = EpaperAction.class.getName();
        params.put(HttpRequest.REQUEST_MODULES, name);
        params.put(HttpRequest.REQUEST_ACTION, EpaperAction.ACTION_SUBMIT_ESSAY_WORK);
        final String json = com.alibaba.fastjson.JSONObject.toJSONString(essayAnswer);
        HeadOverrideRequest request = new HeadOverrideRequest(Request.Method.POST, params,
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError volleyError) {
                        callBack.failed(volleyError);
                    }
                }, new BaseRequest.ResponseCallback() {
            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);

            }

            @Override
            public void success(Object obj, int resultCode, int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    if (null != callBack)
                        callBack.success(obj);
                } else {
                    if (null != callBack) {
                        callBack.failed(errorCode, msg);
                    }
                }
            }
        }) {
            @Override
            public byte[] getBody() throws AuthFailureError {
                return json.getBytes();
            }
        };

        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        request.setResponseClazz(EssayResult.class);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());
    }

    /**
     * 查询学校列表
     *
     * @param schoolArea 最后一级地区代码(直辖市,区/县)
     * @param period     学校学段
     * @param keyWords
     * @param page
     * @param pagesize
     * @param callBack
     */
    public static void getSchoolList(String schoolArea, String period, String keyWords, String brandId, int page, int pagesize, final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION,
                EpaperAction.ACTION_RELATION_GET_SCHOOL_LIST);
        if (null != schoolArea && !"".equals(schoolArea)) {
            params.put("schoolArea", schoolArea);
        }
        if (null != period && !"".equals(period)) {
            params.put("period", period);
        }
        if (null != keyWords && !"".equals(keyWords)) {
            params.put("keyWords", keyWords);
        }
        params.put("brandId", brandId);
        params.put("page", page + "");
        params.put("pageSize", pagesize + "");

        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {

                    @Override
                    public void onErrorResponse(VolleyError error) {
                        if (null != callBack)
                            callBack.failed(error);
                    }
                }, new BaseRequest.ResponseCallback() {

            @Override
            public void error(int errorCode, String msg) {
                if (null != callBack)
                    callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    if (null != callBack)
                        callBack.success(obj);
                } else {
                    if (null != callBack)
                        callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        Type responseType = new TypeToken<SchoolPageBean>() {
        }.getType();
        request.setResponseType(responseType);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());
    }


    public static void getDubbingVideoRecommend(int gradeId, final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION,
                EpaperAction.ACTION_GET_DUB_VIDEO_RECOMMEND);
        params.put("gradeId", gradeId + "");

        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {

                    @Override
                    public void onErrorResponse(VolleyError error) {
                        if (null != callBack)
                            callBack.failed(error);
                    }
                }, new BaseRequest.ResponseCallback() {

            @Override
            public void error(int errorCode, String msg) {
                if (null != callBack)
                    callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    if (null != callBack)
                        callBack.success(obj);
                } else {
                    if (null != callBack)
                        callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        Type responseType = new TypeToken<List<DubHotWord>>() {
        }.getType();
        request.setResponseType(responseType);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());
    }

    public static void getDubbingVideoCid(int gradeId, final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION,
                EpaperAction.ACTION_GET_DUB_VIDEO_CID);
        params.put("gradeId", gradeId + "");

        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {

                    @Override
                    public void onErrorResponse(VolleyError error) {
                        if (null != callBack)
                            callBack.failed(error);
                    }
                }, new BaseRequest.ResponseCallback() {

            @Override
            public void error(int errorCode, String msg) {
                if (null != callBack)
                    callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    if (null != callBack)
                        callBack.success(obj);
                } else {
                    if (null != callBack)
                        callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        Type responseType = new TypeToken<List<DubHotWord>>() {
        }.getType();
        request.setResponseType(responseType);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());
    }

    public static void getDubbingVideoListBycId(String packageId, String cId, int page, int pageSize, final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION,
                EpaperAction.ACTION_GET_DUBBINT_LIST_BY_CID);
        params.put("packageId", packageId);
        params.put("cId", cId);
        params.put("page", page + "");
        params.put("pagesize", pageSize + "");

        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {

                    @Override
                    public void onErrorResponse(VolleyError error) {
                        if (null != callBack)
                            callBack.failed(error);
                    }
                }, new BaseRequest.ResponseCallback() {

            @Override
            public void error(int errorCode, String msg) {
                if (null != callBack)
                    callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    if (null != callBack)
                        callBack.success(obj);
                } else {
                    if (null != callBack)
                        callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        Type responseType = new TypeToken<List<WorkContent>>() {
        }.getType();
        request.setResponseType(responseType);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());
    }

    public static void getDubbingVideoListByName(int gradeId, String name, int page, int pageSize, final BaseExtCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION,
                EpaperAction.ACTION_GET_DUBBING_LIST_BY_NAME);
        params.put("gradeId", gradeId + "");
        params.put("name", name);
        params.put("page", page + "");
        params.put("pagesize", pageSize + "");

        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {

                    @Override
                    public void onErrorResponse(VolleyError error) {
                        if (null != callBack)
                            callBack.failed(error);
                    }
                }, new BaseRequest.ResponseCallback() {

            @Override
            public void error(int errorCode, String msg) {
                if (null != callBack)
                    callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    if (null != callBack)
                        callBack.success(obj);
                } else {
                    if (null != callBack)
                        callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        Type responseType = new TypeToken<List<WorkContent>>() {
        }.getType();
        request.setResponseType(responseType);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());
    }

    public static void searchSchool(String areaCode, int period, String wd, int page, int pagesize, final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION,
                EpaperAction.ACTION_RELATION_SEARCH_SCHOOL);

        params.put("areaCode", areaCode);
        params.put("period", period + "");
        params.put("wd", wd);
        params.put("page", page + "");
        params.put("pagesize", pagesize + "");

        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {

                    @Override
                    public void onErrorResponse(VolleyError error) {
                        if (null != callBack)
                            callBack.failed(error);
                    }
                }, new BaseRequest.ResponseCallback() {

            @Override
            public void error(int errorCode, String msg) {
                if (null != callBack)
                    callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    if (null != callBack)
                        callBack.success(obj);
                } else {
                    if (null != callBack)
                        callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        Type responseType = new TypeToken<BasePaging<SchoolPageBean>>() {
        }.getType();
        request.setResponseType(responseType);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());
    }


    /**
     * 提交作业答案
     *
     * @param oldJson  答案json
     * @param callBack 回调
     */

    public static void submitDubingVideo(final String oldJson, int workType, final String workId, Class clazz, final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION, EpaperAction.ACTION_SUBMIT_VIDEO_WORKS);
        String sign = DeviceUtil.hmacSha1(oldJson, EConstants.HMACSHA1_SECRECT);
        params.put("sign", sign);
        JSONObject jsonObject = new JSONObject();
        try {
            jsonObject.put("data", oldJson);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        final String json = jsonObject.toString();
        HeadOverrideRequest request = new HeadOverrideRequest(Request.Method.POST, params,
                new Response.ErrorListener() {

                    @Override
                    public void onErrorResponse(VolleyError error) {
                        callBack.failed(error);
                    }
                }, new BaseRequest.ResponseCallback() {

            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
                String logDesc = "习网服务器提交答案失败  " + json;
                String remark = "workId==" + workId + "; errorCOde==" + errorCode + " ; msg==" + msg;
                FeedbackUtil.getInstance().addFeedbackLog(FeedbackUtil.FEEDBACK_TYPE_SUBMIT_WORK, logDesc, remark);
            }

            @Override
            public void success(Object obj, int resultCode, int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    if (null != callBack)
                        callBack.success(obj);
                } else {
                    if (null != callBack) {
                        callBack.failed(errorCode, msg);

                        String logDesc = "习网服务器提交答案失败  " + json;
                        String remark = "workId==" + workId + "; errorCOde==" + errorCode + " ; msg==" + msg;
                        FeedbackUtil.getInstance().addFeedbackLog(FeedbackUtil.FEEDBACK_TYPE_SUBMIT_WORK, logDesc, remark);
                    }
                }
            }
        }) {
            @Override
            public byte[] getBody() throws AuthFailureError {
                return json.getBytes();
            }
        };
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        request.setResponseClazz(clazz);
        BaseRequestUtil.getInstance().add(request, "" + workId);
        callBack.setUrl(request.getUrl());
    }

    /**
     * 查询分数借口  听说模考 线上做答
     *
     * @param callBack 回调
     */
    public static void getOnlineScore(final String doWorkId,
                                      final BaseCallBack callBack) {

        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION,
                EpaperAction.ACTION_GET_SCORE_OF_ONLINE);
        params.put("doWorkId", doWorkId);


        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {

                    @Override
                    public void onErrorResponse(VolleyError error) {
                        callBack.failed(error);
                    }
                }, new BaseRequest.ResponseCallback() {

            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        request.setResponseClazz(Result_scoce.class);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());

    }

    /**
     * 更新提交过的单元测试作业
     *
     * @param doWorkId 做作业ID
     * @param callBack 回调
     */
    public static void updateUnitTestWork(final String doWorkId,
                                          final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION,
                EpaperAction.ACTION_UPDATE_UNIT_TEST_WORKS);
        params.put("doWorkId", doWorkId);
        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {

                    @Override
                    public void onErrorResponse(VolleyError error) {
                        callBack.failed(error);
                    }
                }, new BaseRequest.ResponseCallback() {

            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        }) {
        };
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        request.setResponseClazz(String.class);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());
    }

    /**
     * 添加书籍到书柜记录
     *
     * @param brandId
     * @param productId
     * @param callBack
     */
    public static void setBookcaseToServer(int brandId, String productId, int serviceId, final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION,
                EpaperAction.ACTION_SET_EPAGE_BOOKCASE);
        params.put("brandId", brandId + "");
        params.put("productId", productId);
        params.put("serviceId", serviceId + "");
        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {

                    @Override
                    public void onErrorResponse(VolleyError error) {
                        callBack.failed(error);
                    }
                }, new BaseRequest.ResponseCallback() {

            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        //request.setResponseClazz(String.class);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());

    }


    /**
     * 删除书柜记录By书箱ID
     *
     * @param brandId
     * @param productId
     * @param callBack
     */
    public static void setDelBookcaseToServer(int brandId, String productId, int serviceId, final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION,
                EpaperAction.ACTION_DEL_EPAGE_BOOKCASE);
        params.put("brandId", brandId + "");

        params.put("productId", productId);
        params.put("serviceId", serviceId + "");
//        params.put("deletePara", "{["",""],["",""]}");


        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {

                    @Override
                    public void onErrorResponse(VolleyError error) {
                        callBack.failed(error);
                    }
                }, new BaseRequest.ResponseCallback() {

            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        //request.setResponseClazz(String.class);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());

    }


    /**
     * 删除书柜记录By书箱ID
     *
     * @param brandId
     * @param callBack
     */
    public static void setDelBookcaseToServerByList(int brandId, ArrayList<DeleteEP> deleteEPList, final BaseCallBack callBack) {

        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION, EpaperAction.ACTION_DEL_EPAGE_BOOKCASE_LIST);

        DeleteEpInfo deleteEpInfo = new DeleteEpInfo();
        deleteEpInfo.setBrandId(brandId);
        Gson gson = new Gson();
        Type responseType;
        responseType = new TypeToken<List<DeleteEP>>() {
        }.getType();
        String deleteJson = gson.toJson(deleteEPList, responseType);
        deleteEpInfo.setDelParam(deleteJson);
        String json = new Gson().toJson(deleteEpInfo, DeleteEpInfo.class);
        Log.d("EpaperFragment", "####deleteJson#########" + deleteJson);

        try {
            JSONObject jsonObject = new JSONObject(json);
            String key = "delParam";
            if (jsonObject.has(key)) {
                JSONArray array = new JSONArray(deleteEpInfo.getDelParam());
                jsonObject.remove(key);
                jsonObject.put(key, array);
                json = jsonObject.toString();
            }
            Log.d("EpaperFragment", "####json#########" + json);
        } catch (Exception e) {
            if (e != null) {
                Log.d("EpaperFragment", "############e#############" + e.getMessage());
            }
        }

        final String commitJson = json;


        HeadOverrideRequest request = new HeadOverrideRequest(Request.Method.POST, params,
                new Response.ErrorListener() {

                    @Override
                    public void onErrorResponse(VolleyError error) {
                        callBack.failed(error);
                    }
                }, new BaseRequest.ResponseCallback() {

            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        }) {
            @Override
            public byte[] getBody() throws AuthFailureError {
                return commitJson.getBytes();
            }
        };
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        //request.setResponseClazz(String.class);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());

    }


    /**
     * 获取视频讲解答案
     *
     * @param callBack 回调
     */
    public static void getVideoExplainAnswer(String doWorkId, int requestType,
                                             final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION, EpaperAction.ACTION_GET_VIDEO_EXPLAN_ANSWER);
//        params.put("brandId", brandId + "");
        params.put("doWorkId", doWorkId + "");
//        params.put("packageId", packageId + "");
//        params.put("cid", cid + "");
//        params.put("resourceType", resourceType + "");

        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {

                    @Override
                    public void onErrorResponse(VolleyError error) {
                        callBack.failed(error);
                    }
                }, new BaseRequest.ResponseCallback() {

            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {

                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });

        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        Type responseType;
        if (requestType == EpaperConstant.H5_JUMP_TYPE_ONLINE_ANSWER) {
            responseType = new TypeToken<List<TempWorkAnswers>>() {
            }.getType();

        } else {

            responseType = new TypeToken<List<VideoExplainWorkAnswers>>() {
            }.getType();

        }


        request.setResponseType(responseType);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());

    }

    /**
     * 获取在线作答答案
     *
     * @param callBack 回调
     */
    public static void getOnlineAnswer(String doWorkId, final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION, EpaperAction.ACTION_GET_VIDEO_EXPLAN_ANSWER);
        params.put("doWorkId", doWorkId + "");

        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {

                    @Override
                    public void onErrorResponse(VolleyError error) {
                        callBack.failed(error);
                    }
                }, new BaseRequest.ResponseCallback() {

            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode, int errorCode, String msg) {

                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });

        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        Type responseType = new TypeToken<List<TempWorkAnswers>>() {
        }.getType();
        request.setResponseType(responseType);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());

    }

    /**
     * 检查权限
     *
     * @param brandId       品牌ID（商家ID）
     * @param serviceTypeId 服务ID （可单独参数）
     * @param goodsId       书本ID（可单独参数）
     * @param chapterId     书本目录ID（可单独参数）(后期添加)
     * @param quesId        问题id
     */
    public static void checkValid(String brandId, String serviceTypeId, String goodsId, String chapterId,
                                  String quesId, BaseCallBack baseCallBack) {
        checkValid(brandId, serviceTypeId, goodsId, chapterId, quesId, 0, baseCallBack);
    }

    /**
     * 检查权限
     *
     * @param brandId       品牌ID（商家ID）
     * @param serviceTypeId 服务ID （可单独参数）
     * @param goodsId       书本ID（可单独参数）
     * @param chapterId     书本目录ID（可单独参数）(后期添加)
     * @param quesId        问题id
     * @param workType      作业类型
     */
    public static void checkValid(String brandId, String serviceTypeId, String goodsId, String chapterId,
                                  String quesId, int workType, final BaseCallBack baseCallBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION, EpaperAction.ACTION_CHECKVALID);
        params.put("brandId", brandId + "");
        params.put("workType", workType + "");
        if (!TextUtils.isEmpty(serviceTypeId)) {
            params.put("serviceTypeId", serviceTypeId + "");
        }
        if (!TextUtils.isEmpty(goodsId)) {
            params.put("goodsId", goodsId + "");
        }
        if (!TextUtils.isEmpty(quesId)) {
            params.put("quesId", quesId + "");
        }
        if (!TextUtils.isEmpty(chapterId) && null != chapterId) {
            params.put("chapterId", chapterId + "");
        }
        HttpRequest httpRequest = new HttpRequest(params, new Response.ErrorListener() {

            @Override
            public void onErrorResponse(VolleyError volleyError) {
                baseCallBack.failed(volleyError);
            }
        }, new BaseRequest.ResponseCallback() {
            @Override
            public void error(int errorCode, String msg) {
                baseCallBack.failed(errorCode, msg);
                super.error(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode, int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    baseCallBack.success(obj);
                } else {
                    baseCallBack.failed(errorCode, msg);
                }
            }
        });
        httpRequest.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        Type responseType = new TypeToken<CheckValidBean>() {
        }.getType();
        httpRequest.setResponseType(responseType);
        BaseRequestUtil.getInstance().add(httpRequest);
        baseCallBack.setUrl(httpRequest.getUrl());
    }

    public static void getServicesList(String brandId, final BaseCallBack baseCallBack) {
        Map<String, String> params = new HashMap<>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION, EpaperAction.ACTION_USER_SERVICES);
        params.put("brandId", brandId + "");
        HttpRequest httpRequest = new HttpRequest(params, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError volleyError) {
                baseCallBack.failed(volleyError);
            }
        }, new BaseRequest.ResponseCallback() {

            @Override
            public void success(Object obj, int resultCode, int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    baseCallBack.success(obj);
                } else {
                    baseCallBack.failed(errorCode, msg);
                }
            }

            @Override
            public void error(int errorCode, String msg) {
                baseCallBack.failed(errorCode, msg);
                super.error(errorCode, msg);
            }
        });
        httpRequest.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        Type responseType = new TypeToken<List<EpaperInfo.Server>>() {
        }.getType();
        httpRequest.setResponseType(responseType);
        BaseRequestUtil.getInstance().add(httpRequest);
        baseCallBack.setUrl(httpRequest.getUrl());

    }

    public static void getUserProductByKey(String brandId, String grade, String serviceId, String keyWords, int pageIndex, int pageSize, final BaseCallBack baseCallBack) {
        Map<String, String> params = new HashMap<>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION, EpaperAction.GET_USER_PRODUCT_BY_KEY);
        params.put("brandId", brandId + "");
        params.put("grade", grade);
        params.put("serviceId", serviceId);
        params.put("keyWords", keyWords);
        params.put("pageIndex", pageIndex + "");
        params.put("pageSize", pageSize + "");
        HttpRequest httpRequest = new HttpRequest(params, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError volleyError) {
                baseCallBack.failed(volleyError);
            }
        }, new BaseRequest.ResponseCallback() {

            @Override
            public void success(Object obj, int resultCode, int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    baseCallBack.success(obj);
                } else {
                    baseCallBack.failed(errorCode, msg);
                }
            }

            @Override
            public void error(int errorCode, String msg) {
                baseCallBack.failed(errorCode, msg);
                super.error(errorCode, msg);
            }
        });
        httpRequest.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        Type responseType = new TypeToken<BookCaseBean>() {
        }.getType();
        httpRequest.setResponseType(responseType);
        BaseRequestUtil.getInstance().add(httpRequest);
        baseCallBack.setUrl(httpRequest.getUrl());

    }


    public static void getBookKey(String brandId, String schoolId, final BaseCallBack baseCallBack) {
        Map<String, String> params = new HashMap<>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION, EpaperAction.GET_BOOK_KEY);
        params.put("brandId", brandId + "");
        params.put("schoolId", schoolId + "");
        HttpRequest httpRequest = new HttpRequest(params, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError volleyError) {
                baseCallBack.failed(volleyError);
            }
        }, new BaseRequest.ResponseCallback() {

            @Override
            public void success(Object obj, int resultCode, int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    baseCallBack.success(obj);
                } else {
                    baseCallBack.failed(errorCode, msg);
                }
            }

            @Override
            public void error(int errorCode, String msg) {
                baseCallBack.failed(errorCode, msg);
                super.error(errorCode, msg);
            }
        });
        httpRequest.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        Type responseType = new TypeToken<List<SearchBookKeyNameBean>>() {
        }.getType();
        httpRequest.setResponseType(responseType);
        BaseRequestUtil.getInstance().add(httpRequest);
        baseCallBack.setUrl(httpRequest.getUrl());

    }


    public static void getBookOrServiceList(int brandId, int page, int pageSize, int schoolId, int gradeId,
                                            int subjectId, int salesType, String area, String keyWords, final BaseCallBack baseCallBack) {
        Map<String, String> params = new HashMap<>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION, EpaperAction.ACTION_SEARCH_BOOK_AND_SERVICE);


        params.put("brandId", brandId + "");
        params.put("schoolId", schoolId + "");
        params.put("gradeId", gradeId + "");
        params.put("subjectId", subjectId + "");
        params.put("salesType", salesType + "");
        params.put("area", area + "");
        params.put("pIndex", page + "");
        params.put("psize", pageSize + "");

        if (!TextUtils.isEmpty(keyWords)) {
            params.put("keyWords", keyWords + "");
        }


        HttpRequest httpRequest = new HttpRequest(params, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError volleyError) {
                baseCallBack.failed(volleyError);
            }
        }, new BaseRequest.ResponseCallback() {

            @Override
            public void success(Object obj, int resultCode, int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    baseCallBack.success(obj);
                } else {
                    baseCallBack.failed(errorCode, msg);
                }
            }

            @Override
            public void error(int errorCode, String msg) {
                baseCallBack.failed(errorCode, msg);
                super.error(errorCode, msg);
            }
        });
        httpRequest.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        Type responseType = new TypeToken<BasePaging<NewBook>>() {
        }.getType();
        httpRequest.setResponseType(responseType);
        BaseRequestUtil.getInstance().add(httpRequest);
        baseCallBack.setUrl(httpRequest.getUrl());

    }


    public static void getBookOrServiceListByType(int brandId, int applyType, int page, int pageSize, int schoolId, int gradeId, int subjectId, String area, final BaseCallBack baseCallBack) {
        Map<String, String> params = new HashMap<>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION, EpaperAction.ACTION_SEARCH_BOOK_AND_SERVICE_BY_TYPE);


        params.put("brandId", brandId + "");
        params.put("applyType", applyType + "");

        if (!TextUtils.isEmpty(area)) {
            params.put("area", area + "");
        }


        params.put("gradeId", gradeId + "");
        params.put("subjectId", subjectId + "");
        params.put("schoolId", schoolId + "");

        params.put("pIndex", page + "");
        params.put("psize", pageSize + "");


        HttpRequest httpRequest = new HttpRequest(params,
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError volleyError) {
                        baseCallBack.failed(volleyError);
                    }
                }, new BaseRequest.ResponseCallback() {

            @Override
            public void success(Object obj, int resultCode, int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    baseCallBack.success(obj);
                    CWLog.d("setResponseDataType####", obj + "");
                    CWLog.d("setResponseDataType$####222", obj.toString() + "");
                } else {
                    baseCallBack.failed(errorCode, msg);
                }
            }

            @Override
            public void error(int errorCode, String msg) {
                baseCallBack.failed(errorCode, msg);
                super.error(errorCode, msg);
            }
        });
       /* if (applyType==5){
            httpRequest.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_STRING);
        }else {
            httpRequest.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        }*/
        httpRequest.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        Type responseType = new TypeToken<BasePaging<NewBook>>() {
        }.getType();
        httpRequest.setResponseType(responseType);
        BaseRequestUtil.getInstance().add(httpRequest);
        baseCallBack.setUrl(httpRequest.getUrl());

    }

    public static void getSubjectListByGrade(int brandId, int gradeId, int salesType, String area, int schoolId, int applyType,
                                             final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION, EpaperAction.ACTION_GET_SUBJECT_LIST);
        params.put("gradeId", gradeId + "");
        params.put("brandId", brandId + "");
        params.put("salesType", salesType + "");
        params.put("area", area + "");
        params.put("schoolId", schoolId + "");
        params.put("applyType", applyType + "");

        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError volleyError) {
                        callBack.failed(volleyError);
                    }
                }, new BaseRequest.ResponseCallback() {
            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        Type responseType = new TypeToken<List<Subject>>() {
        }.getType();
        request.setResponseType(responseType);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());

    }


    /**
     * 根据品牌ID获取自主学习书籍
     *
     * @param brandId
     * @param callBack
     */
    public static void getAutonomicStudyBooks(int brandId, final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION,
                EpaperAction.ACTION_GET_AUTONMONIC_STUDY_BOOKS);
        params.put("brandId", brandId + "");

        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {

                    @Override
                    public void onErrorResponse(VolleyError error) {
                        callBack.failed(error);
                    }
                }, new BaseRequest.ResponseCallback() {

            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        Type responseType = new TypeToken<List<EpaperInfo>>() {
        }.getType();
        request.setResponseType(responseType);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());

    }

    /**
     * 时文阅读-列表
     * @param gradeId
     * @param categoryId
     * @param subCategoryId
     * @param pageIndex
     * @param pageSize
     * @param callBack
     */
    public static void getInteractionList( int gradeId,int categoryId,int subCategoryId, int pageIndex, int pageSize,
                                             final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION,
                EpaperAction.ACTION_GET_ALL_PRODUCTS_BY_GET_INTERACTION_LIST);
        params.put("categoryId", categoryId + "");
        params.put("gradeId", gradeId + "");
        params.put("subCategoryId", subCategoryId + "");
        params.put("page", pageIndex + "");
        params.put("pageSize", pageSize + "");

        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {

                    @Override
                    public void onErrorResponse(VolleyError error) {
                        callBack.failed(error);
                    }
                }, new BaseRequest.ResponseCallback() {

            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        Type responseType = new TypeToken<NewBookReadNetBean>() {
        }.getType();
        request.setResponseType(responseType);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());
    }

    /**
     * 根据标签查询书籍列表
     *
     * @param brandId
     * @param
     */
    public static void getproductsbybookmark(int brandId, int bookmarkId, int gradeId,int subCategoryId, int pageIndex, int pageSize,
                                             final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION,
                EpaperAction.ACTION_GET_ALL_PRODUCTS_BY_BOOKMARK);
        params.put("brandId", brandId + "");
        params.put("bookmarkId", bookmarkId + "");
        params.put("gradeId", gradeId + "");
        params.put("subCategoryId", subCategoryId + "");
        params.put("pageIndex", pageIndex + "");
        params.put("pageSize", pageSize + "");

        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {

                    @Override
                    public void onErrorResponse(VolleyError error) {
                        callBack.failed(error);
                    }
                }, new BaseRequest.ResponseCallback() {

            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        Type responseType = new TypeToken<BookMarkPageInfo>() {
        }.getType();
        request.setResponseType(responseType);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());
    }

    /**
     * 根据标签查询书籍列表(报听写)
     *
     * @param brandId
     * @param
     */
    public static void getStudentProductsByBookmark(int brandId, int bookmarkId, int gradeId, int pageIndex, int pageSize,
                                                    final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION,
                EpaperAction.ACTION_GET_STUDENT_PRODUCTS_BY_BOOKMARK);
        params.put("brandId", brandId + "");
        params.put("bookmarkId", bookmarkId + "");
        params.put("gradeId", gradeId + "");
        params.put("pageIndex", pageIndex + "");
        params.put("pageSize", pageSize + "");

        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {

                    @Override
                    public void onErrorResponse(VolleyError error) {
                        callBack.failed(error);
                    }
                }, new BaseRequest.ResponseCallback() {

            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        Type responseType = new TypeToken<BookMarkPageInfo>() {
        }.getType();
        request.setResponseType(responseType);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());
    }

    public static void getInteractionCategory(final BaseExtCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION,
                EpaperAction.ACTION_GET_TEACHER_BY_CATEGORY);
        params.put("clientId", EConstants.CLIENT_ID);
        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {

                    @Override
                    public void onErrorResponse(VolleyError error) {
                        callBack.failed(error);
                    }
                }, new BaseRequest.ResponseCallback() {

            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        Type responseType = new TypeToken<List<InteractionCategoryBean>>() {
        }.getType();
        request.setResponseType(responseType);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());
    }


    /**
     * 新增接口
     * @param typeID
     * @param callBack
     */
    public static void getGradeByBookCategoryId(int typeID,final BaseExtCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION,
                EpaperAction.ACTION_GET_TEACHER_GRADE_BY_CATEGORY);
        params.put("typeId", typeID + "");
        params.put("clientId", EConstants.CLIENT_ID);
        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {

                    @Override
                    public void onErrorResponse(VolleyError error) {
                        callBack.failed(error);
                    }
                }, new BaseRequest.ResponseCallback() {

            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        Type responseType = new TypeToken<List<EpaperInfoGradeCategoryBean>>() {
        }.getType();
        request.setResponseType(responseType);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());
    }



    /**
     * 按书签查询有书的年级（学生）
     *
     * @param brandId
     * @param mBookmarkId
     * @param callBack
     */
    public static void getGradeByBookmarkId(int brandId, int mBookmarkId, final BaseExtCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION,
                EpaperAction.ACTION_GET_TEACHER_GRADE_BY_BOOKMARK);
        params.put("brandId", brandId + "");
        params.put("bookmarkId", mBookmarkId + "");
        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {

                    @Override
                    public void onErrorResponse(VolleyError error) {
                        callBack.failed(error);
                    }
                }, new BaseRequest.ResponseCallback() {

            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        Type responseType = new TypeToken<List<GradeBean>>() {
        }.getType();
        request.setResponseType(responseType);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());
    }

    //0,置顶，1，取消置顶
    public static void setHeadLastBooks(String productId, int serviceId, int userId, int action, final BaseCallBack callBack) {
        try {
            Map<String, String> params = new HashMap<String, String>();
            params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
            params.put(HttpRequest.REQUEST_ACTION,
                    EpaperAction.ACTION_GET_SET_HEAD_LASTBOOKS);
            params.put("productId", productId + "");
            params.put("serviceId", serviceId + "");
            params.put("userId", userId + "");
            params.put("action", action + "");

            HttpRequest request = new HttpRequest(params,
                    new Response.ErrorListener() {

                        @Override
                        public void onErrorResponse(VolleyError error) {
                            callBack.failed(error);
                        }
                    }, new BaseRequest.ResponseCallback() {

                @Override
                public void error(int errorCode, String msg) {
                    callBack.failed(errorCode, msg);
                }

                @Override
                public void success(Object obj, int resultCode,
                                    int errorCode, String msg) {
                    if (resultCode == 0 && errorCode == 0) {
                        callBack.success(obj);
                    } else {
                        callBack.failed(errorCode, msg);
                    }
                }
            });
            request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
            Type responseType = new TypeToken<EpaperInfo>() {
            }.getType();
            request.setResponseType(responseType);
            BaseRequestUtil.getInstance().add(request);
            callBack.setUrl(request.getUrl());
        } catch (Exception e) {
            e.getStackTrace();
        }

    }


    public static void getBookDeskHomePage(int brandId, int gradeId, final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION,
                EpaperAction.ACTION_GET_USER_DESK_HEAD);
        params.put("brandId", brandId + "");
        params.put("gradeId", gradeId + "");
//        params.put("gradeId", "9999");
        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {

                    @Override
                    public void onErrorResponse(VolleyError error) {
                        callBack.failed(error);
                    }
                }, new BaseRequest.ResponseCallback() {

            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        request.setResponseClazz(BookDeskBean.class);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());
    }

    public static void getBookDeskCatalogue(String versionId, final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION,
                EpaperAction.ACTION_BOOK_DESK_CATALOGUES);
        //TODO 先写死，无数据
        params.put("versionId", versionId + "");

        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {

                    @Override
                    public void onErrorResponse(VolleyError error) {
                        callBack.failed(error);
                    }
                }, new BaseRequest.ResponseCallback() {

            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    Log.e("获取书籍目录资源成功","success = "+ GsonUtil.toJson(obj));
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        request.setResponseClazz(BookDeskCataloguesBean.class);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());
    }

    /**
     * 获取评分系数
     */
    public static void getScoreCoefficient(final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(com.ciwong.epaper.util.HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        params.put(com.ciwong.epaper.util.HttpRequest.REQUEST_ACTION, EpaperAction.ACTION_GET_SCORE_COEFFICIENT);
        params.put("brandId", EApplication.BRAND_ID + "");
        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError volleyError) {
                        callBack.failed(volleyError);
                    }
                }, new BaseRequest.ResponseCallback() {
            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        request.setResponseClazz(Float.class);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());
    }

    /**
     * 根据年级查询配音资源列表
     *
     * @param gradeId
     * @param
     */
    public static void getDubbingVideoList(int gradeId, int pageIndex, int pageSize,
                                           final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION,
                EpaperAction.ACTION_GET_DUBBING_VIDEO_LIST);
        params.put("gradeId", gradeId + "");
//        params.put("gradeId", "9999");
        params.put("page", pageIndex + "");
        params.put("pagesize", pageSize + "");

        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {

                    @Override
                    public void onErrorResponse(VolleyError error) {
                        callBack.failed(error);
                    }
                }, new BaseRequest.ResponseCallback() {

            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        Type responseType = new TypeToken<List<WorkContent>>() {
        }.getType();
        request.setResponseType(responseType);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());
    }

    /**
     * 根据资源
     *
     * @param versionId
     * @param
     */
    public static void getDubVideoDetail(String versionId,
                                         final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION,
                EpaperAction.ACTION_GET_DUBBING_VIDEO_DETAIL);
        params.put("versionId", versionId);

        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {

                    @Override
                    public void onErrorResponse(VolleyError error) {
                        callBack.failed(error);
                    }
                }, new BaseRequest.ResponseCallback() {

            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        Type responseType = new TypeToken<WorkContent>() {
        }.getType();
        request.setResponseType(responseType);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());
    }

    /**
     * 查询配音记录列表
     *
     * @param pageIndex
     * @param pageSize
     */
    public static void getDubbingVideoRecordList(int pageIndex, int pageSize,
                                                 final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION,
                EpaperAction.ACTION_GET_DUBBING_VIDEO_RECORD_LIST);
        params.put("page", pageIndex + "");
        params.put("pagesize", pageSize + "");

        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {

                    @Override
                    public void onErrorResponse(VolleyError error) {
                        callBack.failed(error);
                    }
                }, new BaseRequest.ResponseCallback() {

            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        Type responseType = new TypeToken<List<VideoRecord>>() {
        }.getType();
        request.setResponseType(responseType);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());

    }

    /**
     * 获取音标列表
     *
     * @param
     */
    public static void getSymbolsList(final BaseCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION,
                EpaperAction.ACTION_GET_SYMBOLS_LIST);

        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {

                    @Override
                    public void onErrorResponse(VolleyError error) {
                        callBack.failed(error);
                    }
                }, new BaseRequest.ResponseCallback() {

            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        Type responseType = new TypeToken<List<SymbolsContent>>() {
        }.getType();
        request.setResponseType(responseType);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());
    }

    /**
     * 学生获取打卡作业列表
     *
     * @param callBack
     * @param brandId
     * @param page
     * @param pageSize
     */
    public static void getUserDkWorks(int brandId, int page, int pageSize, final BaseExtCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION,
                EpaperAction.ACTION_GET_DK_LIST);
        params.put("page", page + "");
        params.put("pageSize", pageSize + "");
        params.put("brandId", brandId + "");
        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {

                    @Override
                    public void onErrorResponse(VolleyError error) {
                        callBack.failed(error);
                    }
                }, new BaseRequest.ResponseCallback() {

            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        Type responseType = new TypeToken<UserDKPageBean>() {
        }.getType();
        request.setResponseType(responseType);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());
    }

    /**
     * 学生获取打卡作业详情
     *
     * @param callBack
     * @param workId
     */
    public static void getUserDkWorkDetails(String workId, final BaseExtCallBack callBack) {
        Map<String, String> params = new HashMap<String, String>();
        params.put(HttpRequest.REQUEST_MODULES, EpaperAction.class.getName());
        params.put(HttpRequest.REQUEST_ACTION,
                EpaperAction.ACTION_GET_DK_DETAILS);
        params.put("workId", workId);
        HttpRequest request = new HttpRequest(params,
                new Response.ErrorListener() {

                    @Override
                    public void onErrorResponse(VolleyError error) {
                        callBack.failed(error);
                    }
                }, new BaseRequest.ResponseCallback() {

            @Override
            public void error(int errorCode, String msg) {
                callBack.failed(errorCode, msg);
            }

            @Override
            public void success(Object obj, int resultCode,
                                int errorCode, String msg) {
                if (resultCode == 0 && errorCode == 0) {
                    callBack.success(obj);
                } else {
                    callBack.failed(errorCode, msg);
                }
            }
        });
        request.setResponseDataType(HttpRequest.RESPONSE_DATA_TYPE_OBJECT);
        Type responseType = new TypeToken<DkWorkDetail>() {
        }.getType();
        request.setResponseType(responseType);
        BaseRequestUtil.getInstance().add(request);
        callBack.setUrl(request.getUrl());
    }
}
